#include "NumberUtil.h"

NumberUtil::NumberUtil()
{
}

NumberUtil::~NumberUtil()
{
}

int NumberUtil::isNumber(std::string test)
{
	char number[12] = {'0','1','2','3','4','5','6','7','8','9','.',','};
	bool notfindInNumber = false;
	bool find = false;
	
	if(test.size() > 20)
		return -1;
	else
	{
		for(unsigned int i = 0; i < test.size() && !notfindInNumber; i++)
		{
			find = false;
			for(unsigned int e = 0; e < 12 && !find; e++)
			{
				if((test.at(i) == number[e]) || (i==0 && test.at(i)=='-'))
					find = true;
			}
			if(!find)
				notfindInNumber = true;
		}
		if(notfindInNumber)
			return -1;
		else
			return 1;
	}
}

